package com.musemun.service.function.functionimpl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.musemun.pojo.Crifo;
import com.musemun.pojo.Vo.DataVo;
import com.musemun.service.CrifoService;
import com.musemun.service.CropifoService;
import com.musemun.service.EmployeeService;
import com.musemun.service.function.DataAlaysis;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 文物统计
 * </p>
 *
 * @author ZWYZY
 * @since 2020/5/17
 */
@Service
public class DataAlaysisImpl implements DataAlaysis {
    @Resource
    public CrifoService crifoService;
    @Resource
    public CropifoService cropifoService;
    @Resource
    public EmployeeService employeeService;
    @Override
    public int getCrCount() {

        return crifoService.count();
    }

    @Override
    public int getEmCount() {
        return employeeService.count();
    }

    @Override
    public int getCropCount() {
        return cropifoService.count();

    }

    @Override
    public int getUnCheckCount() {
        LambdaQueryWrapper<Crifo> queryWrapper=new QueryWrapper<Crifo>().lambda().eq(Crifo::getCrCheck,false);
        return crifoService.count(queryWrapper);
    }

    @Override
    public Object getTotalData() {
        DataVo dataVo=new DataVo();
        dataVo.setCrCount(this.getCrCount());
        dataVo.setCropCount(this.getCropCount());
        dataVo.setEmCount(this.getEmCount());
        dataVo.setUnCheckCount(this.getUnCheckCount());
        return dataVo;
    }
}
